Processing math: 100%

Previous Up Next

Main Class

Every program must have a class Main. Furthermore, the Main class must have a method main that takes no formal parameters. The main method may be defined in class Main or it may be inherited from another class. A program is executed by evaluating (newMain).main().

The remaining sections of this manual provide a more formal definition of Cool. There are four sections covering lexical structure (Section 10), grammar (Section 11), type rules (Section 12), and operational semantics (Section 13).

Previous Up Next